<template>    
    <!-- :data-numbox-max='item.info.stock_quantity' -->
    <div ref="numbox" class="mui-numbox" data-numbox-min='1'  style="height:20px">
        <button class="mui-btn mui-btn-numbox-minus" type="button" >-</button>
        <input ref="valbox" id="test" class="mui-input-numbox" type="number" :value="num" @change="onSelChange"/>
        <button class="mui-btn mui-btn-numbox-plus" type="button" >+</button>
    </div>
</template>


<script>
import mui from '../../lib/mui/js/mui.min.js'

export default {
    // 传参
    props: [
        "valmax", 
        "num",
        "item"  // 商品信息        
    ],
    mounted() {
        // 初始化数字选择框
        mui(".mui-numbox").numbox();        
    },
    data() {
        return {
            selectedVal: 1
        }
    },
    methods: {
        onSelChange() {            
            // 修改商品数量            
            this.item.count = parseInt(this.$refs.valbox.value);

            

            console.log("数量改变了", this.item)
            this.$store.commit('updateShopCar', this.item);            
        }
    }
    
}
</script>


<style lang="scss" scoped>

</style>
